﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MMK.PaketTracker.Server.Definitions
{
    [Serializable]
    public class BaseUniqueIdentifier
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="T:BaseUniqueIdentifier"/> class.
        /// </summary>
        public BaseUniqueIdentifier() { }

        /// <summary>
        /// Initializes a new instance of the <see cref="T:BaseUniqueIdentifier"/> class.
        /// </summary>
        /// <param name="guid">The GUID.</param>
        public BaseUniqueIdentifier(Guid guid)
        {
            this.guid = guid;
        }

        private Guid guid;

        /// <summary>
        /// Gets or sets the GUID.
        /// </summary>
        /// <value>The GUID.</value>
        public Guid Guid
        {
            get
            {
                if (this.guid == Guid.Empty)
                    this.guid = Guid.NewGuid();

                return this.guid;
            }
            set
            {
                this.guid = value;
            }
        }
    }
}
